SSEGADD Function ---------------------------------------------------------------------------- Action Returns the far address of a string variable (both segment and offset). Syntax SSEGADD( stringvariable$) Remarks The argument stringvariable$ is the string variable for which you want an address. It can be a simple string variable or a single element of a string array. You cannot use fixed-length string arguments. The SSEGADD function combines the segment and offset information into one long integer (4 bytes). SSEG returns the far address for a string. It is typically used in mixed-language programming to obtain far addresses before passing far strings to procedures written in other languages. SSEGADD usually is used with far strings but also can be used with strings stored in DGROUP. The offset of a string can be found with the SADD function, while the segment of a string can be found with the SSEG function. See Also BLOAD, BSAVE, DEF SEG, SADD, SSEG, PEEK, POKE Example The following example passes a string to a C routine. It uses SSEGADD to obtain the memory address of the string. DEFINT A-Z DECLARE SUB printmessage CDECL (BYVAL farstring AS LONG) ' Create the message as an ASCIIZ string (last character null), ' as required by the C function printf. a$ = "This is a short example of a message" + CHR$(0) ' Call the C function with pointers CALL printmessage(SSEGADD(a$)) This C routine prints a BASIC far string on the screen. #include -* Define a procedure which inputs a string far pointer *- void printmessage (char far *farpointer) { -* print the string addressed by the far pointer *- printf( "%s\n", farpointer); }